home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / stepandrepeat.pprx < prev    next >
Text File  |  1992-03-14  |  2KB  |  98 lines

  1. /*
  2. @BStepAndRepeat  @P@ICopyright Gold Disk Inc., February, 1992
  3. This Genie will make multiple copies of a box with user specified offset and rotation between copies.
  4. */
  5. cr = '0a'x
  6. address command
  7. call SafeEndEdit.rexx()
  8. units = ppm_GetUnits()
  9. if units = 3 then
  10.     call ppm_SetUnits(1)
  11.  
  12. signal on halt
  13. signal on break_c
  14. signal on break_e
  15. signal on break_d
  16. form    = "Columns"cr"Rows"cr"Gutter"
  17.  
  18. /* This Genie allows user to duplicate, move and rotate a box
  19.  * in one step
  20.  */
  21.  
  22. box = ppm_ClickOnBox("Click on box to duplicate..")
  23. if box = 0 then exit_msg()
  24. dup = 0
  25.  
  26. boxpos  = ppm_GetBoxPosition(box)
  27. cur_x   = word(boxpos, 1 )
  28. cur_y   = word(boxpos, 2 )
  29.  
  30. boxsize = ppm_GetBoxSize(box)
  31. width   = word(boxsize, 1 )
  32. height  = word(boxsize, 2 )
  33.  
  34. if units = 3 then
  35. do
  36.    call ppm_ShowStatus("Position: " || ppm_ConvertUnits(1, 3, cur_x) || ", " || ppm_ConvertUnits(1, 3, cur_y) || " size: w" || ppm_ConvertUnits(1, 3, width) || ", h" || ppm_ConvertUnits(1, 3, height))
  37.  
  38.    form = "count:1"cr"horizontal offset:" || ppm_ConvertUnits(1, 3, width)||cr"vertical offset:" || ppm_ConvertUnits(1, 3, height)||cr"angle"
  39.  
  40. end
  41. else
  42. do
  43.    call ppm_ShowStatus("Position: "cur_x", "cur_y" size: w"width", h"height)
  44.    form ="count:1"cr"horizontal offset:"width||cr"vertical offset:"height||cr"angle"
  45. end
  46.  
  47. form = ppm_GetForm("Step & Repeat", 8, form)
  48. if form = '' then exit_msg()
  49. parse var form count '0a'x  horizontal '0a'x vertical '0a'x angle
  50.  
  51. if count = '' then count = 1
  52. if horizontal = '' then horizontal = 0
  53. if vertical = '' then vertical = 0
  54. if angle = '' then angle = 0
  55.  
  56. if ~(datatype(count, n) & datatype(horizontal, n) & datatype(vertical, n) & datatype(angle, n)) then exit_msg("Invalid Entry")
  57.  
  58. if units = 3 then
  59. do
  60.    horizontal = ppm_ConvertUnits(3, 1, horizontal)
  61.    vertical = ppm_ConvertUnits(3, 1, vertical)
  62. end
  63.  
  64. call ppm_AutoUpdate(0)
  65. rotationangle = angle
  66.  
  67. do i = 1 to count
  68.  
  69.     newbox = ppm_CloneBox(box, horizontal, vertical)
  70.  
  71.     if angle ~= 0 then
  72.     do
  73.         call ppm_SetBoxAngle(newbox, rotationangle)
  74.         rotationangle = rotationangle + angle
  75.     end
  76.  
  77.     box = newbox
  78.  
  79. end
  80.  
  81. exit_msg()
  82. break_d:
  83. break_e:
  84. break_c:
  85. halt:
  86.     call exit_msg("User aborted Genie!")
  87.  
  88. exit_msg: procedure  expose units
  89. do
  90.     parse arg message
  91.  
  92.     if message ~= '' then call ppm_Inform(1, message,)
  93.     call ppm_ClearStatus()
  94.    if units = 3 then call ppm_SetUnits(3)
  95.     call ppm_AutoUpdate(1)
  96.     exit
  97. end
  98.